From eff0c509f748f8d8d3e1908fff3b028579d59ce7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 4 Sep 2025 16:31:09 -0400 Subject: [PATCH] more --- Annex/Link.hs | 6 ++++-- ...nt_6_172a92bf49be25355dda3f88b377a6f4._comment | 15 ++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Annex/Link.hs b/Annex/Link.hs index 6cef911a11..480a00ce25 100644 --- a/Annex/Link.hs +++ b/Annex/Link.hs @@ -36,6 +36,7 @@ import Utility.FileMode import Utility.InodeCache import Utility.Tmp.Dir import Utility.CopyFile +import Utility.OpenFd import qualified Database.Keys.Handle import qualified Utility.RawFilePath as R import qualified Utility.FileIO as F @@ -447,8 +448,9 @@ isPointerFile f = catchDefaultIO Nothing $ #else #if MIN_VERSION_unix(2,8,0) let open = do - fd <- openFd (fromOsPath f) ReadOnly - (defaultFileFlags { nofollow = True, cloexec = True }) + fd <- openFdWithMode (fromOsPath f) ReadOnly Nothing + (defaultFileFlags { nofollow = True }) + (CloseOnExecFlag True) fdToHandle fd in bracket open hClose readhandle #else diff --git a/doc/bugs/35_failed_tests_on_beegfs/comment_6_172a92bf49be25355dda3f88b377a6f4._comment b/doc/bugs/35_failed_tests_on_beegfs/comment_6_172a92bf49be25355dda3f88b377a6f4._comment index 4d33caa11d..8ba69239de 100644 --- a/doc/bugs/35_failed_tests_on_beegfs/comment_6_172a92bf49be25355dda3f88b377a6f4._comment +++ b/doc/bugs/35_failed_tests_on_beegfs/comment_6_172a92bf49be25355dda3f88b377a6f4._comment @@ -3,11 +3,14 @@ subject="""comment 6""" date="2025-09-04T18:24:33Z" content=""" -Note that `openFile` is not the only one that would need to be dealt with. -Also `withFile`, `openBinaryFile`, and `withBinaryFile`. +`openFile` is not the only one that would need to be dealt with. +Also `withFile`, `openBinaryFile`, `withBinaryFile`, `appendFile`, +and `openTempFile`, `readFile, and `writeFile` (including `L.` versions). -And, since none of those provide a way to set CloseOnExec, they would have -to be changed to use `openFd` with CloseOnExec, and then mkHandleFromFD. +Since none of those provide a way to set CloseOnExec, they would have +to be changed to be implemented using `openFd` with CloseOnExec, and +then mkHandleFromFD. Or rewritten to use + I have checked and none of those are ever used to create a handle that is intentionally passed to a child process. The only uses of `handleToFd` @@ -17,5 +20,7 @@ versions of all of those. Also there are a few uses of `openFd` that don't set CloseOnExec. -And possibly also some libraries might open files, I don't know. +There is also the problem that any haskell library that does anything +with a file might use any of the above internally without setting +close-on-exec. """]] -- 2.30.2